package cn.wolfcode.car.business.query;


import cn.wolfcode.car.common.base.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Calendar;
import java.util.Date;

@Setter
@Getter
public class CustomerQuery extends QueryObject {
    private String keyword;
    private Integer openState;
    private Integer province;
    //年月日高级查询
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endTime;
    //将结束时间往后加一天.可以搜索一天内所有的数据
    public Date getEndTime(){
        Calendar calendar = Calendar.getInstance();
        if (endTime!=null){
            calendar.setTime(endTime);
            calendar.add(Calendar.DAY_OF_WEEK,1);
            return calendar.getTime();
        }else {
            return null;
        }
    }
}
